package WaiBao;

import java.util.Arrays;

public class ZhaoJing {
    public static void main(String[] args) {
        String[] Tname = {"李宁(班长)", "张国伟(团支书)", "小李(学习委员)", "苏炳添(体育委员)", "刘宇星", "李浩", "李文", "李雯雯", "李如雪", "张洪村", "李德裕", "赵富贵",
                "赵德发", "李庆宇", "刘庆龙", "刘志豪", "欧豪辰", "李渡", "叶志勇", "汪峰", "李大发", "朵朵", "小花", "黑蛋", "二拇哥", "大拇指", "小秀", "苏兴杰",
                "陈美嘉", "赵菁(学生)"};//考生本人: 赵菁(学生)
        int[] Tage = {18, 19, 21, 18, 20, 21, 21, 21, 19, 19, 18, 19, 18, 20, 22, 20, 18, 20, 18, 18, 18, 19, 18, 20, 20, 18, 19, 20, 18,20};//考生年龄：20岁
        double[] chongqing1 = {67, 96, 60, 77, 74, 76, 78, 80, 73, 84, 60, 87, 71, 79, 65, 68, 69, 69, 66, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 96};
        double[] chongqing2 = {98, 71, 79, 72, 81, 61, 73, 79, 85, 94, 94, 70, 86, 64, 94, 75, 86, 79, 61, 61, 92, 71, 95, 85, 75, 84, 79, 64, 90, 95};
        double[] chongqing3 = {84, 78, 74, 80, 71, 61, 71, 80, 84, 60, 63, 80, 75, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 96};

        double yangyang;//代表每个学生的总分
        double wuhaodong;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            yangyang = chongqing1[i] + chongqing2[i] +chongqing3[i];
//            wuhaodong = ( yangyang * 1.0) / 3;
//            System.out.println(Tname[i] + "的总分为:" +  yangyang);
//            System.out.println(Tname[i] + "的平均分为:" + wuhaodong);
//        }


        double biji1 = 0,biji2 = 0;
        double[] shengwu = new double[30];
//        for (int i = 0; i < 30; i++) {
//            biji1 = chongqing1[i] + chongqing2[i] + chongqing3[i];
//            biji2= (biji1 * 1.0) / 3;
//            shengwu[i] = biji2;
//        }
//
//        for (int i = 0; i < shengwu.length - 1; i++) {
//            for (int j = 0; j < shengwu .length - i - 1; j++) {
//                if (shengwu [j] < shengwu [j + 1]) {
//                    double tep = shengwu[j];
//                    shengwu[j] = shengwu[j + 1];
//                    shengwu [j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(shengwu[i]);
//        }


        double fangxu1 = 0, fangxu2 = 0, fangxu3 = 0;//计算每门课的平均分
        double shinian1 = 0,shinian2 = 0,shinian3 = 0;//计算每门课标准差
        double xiaoxiao1 = 0,xiaoxiao2 = 0, xiaoxiao3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < chongqing1.length; i++) {
            sum2+=chongqing1[i];
        }
        fangxu1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+ fangxu1);
        double Sum = 0;
        for (int i = 0; i < chongqing2.length; i++) {
            Sum+=chongqing2[i];
        }
        fangxu2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+ fangxu2);
        double sum = 0;
        for (int i = 0; i <chongqing3.length; i++) {
            sum+=chongqing3[i];
        }
        fangxu3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+fangxu3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i < chongqing1.length; i++) {
            c1+= (chongqing1[i] - fangxu1)*(chongqing1[i] - fangxu1);
        }
        shinian1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+shinian1);

        for (int i = 0; i < chongqing2.length; i++) {
            c2+= (chongqing2[i] -fangxu2)*(chongqing2[i] -  fangxu2);
        }
        shinian2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+shinian2);

        for (int i = 0; i < chongqing3.length; i++) {
            c3+= (chongqing3[i] - fangxu3)*(chongqing3[i] - fangxu3);
        }
        shinian3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+shinian3);
////////
//        Arrays.sort(chongqing1);
//        Arrays.sort(chongqing2);
//        Arrays.sort(chongqing3);
//        xiaoxiao1 =( chongqing1[14]+chongqing1[15])*1.0/2;
//        xiaoxiao2 =( chongqing2[14]+chongqing2[15])*1.0/2;
//        xiaoxiao3 =(chongqing3[14]+chongqing3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+xiaoxiao1);
//        System.out.println("微生物学的中位数为:"+xiaoxiao2);
//        System.out.println("人体组织解剖学的中位数为:"+xiaoxiao3);


    }
}
